<%--
  Created by IntelliJ IDEA.
  User: Acer
  Date: 2021/1/8
  Time: 10:19
  To change this template use File | Settings | File Templates.
--%>

<%--<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>--%>
<%--<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>--%>
<%--<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>--%>
<%--<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>--%>
<%--<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <%--    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">--%>
    <%--    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>--%>
    <%--    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>--%>
    <%--    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>--%>
    <%--    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>--%>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/bootstrap/4.5.3/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/webjars/jquery/3.5.1/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/popper.js/1.16.0/popper.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/bootstrap/4.5.3/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/vue/2.6.11/vue.min.js"></script>

    <title>Title</title>
</head>
<body>

<div class="container mt-5">

    <div class="row">
        <div class="col"></div>
        <div class="col-sm-8">
            <form action="" class="w-50">
                <div class="input-group">
                    <div class="input-group-prepend"><span class="input-group-text">Username</span></div>
                    <input type="text" id="username" name="username" class="form-control" placeholder="请输入" value="alex">
                    <span class="ml-1 form-text text-danger" id="label_username"></span>
                </div>
                <div class="input-group mt-2">
                    <div class="input-group-prepend"><span class="input-group-text">Password</span></div>
                    <input type="text" id="password" name="password" class="form-control" placeholder="请输入" value="123">

                </div><span class="ml-1 form-text text-danger" id="label_password"></span>
                <div class="input-group mt-2">
                    <input type="submit" class="form-control btn btn-primary">
                </div>
            </form>
        </div>
        <div class="col"></div>
    </div>

</div>

<script>
    $(function () {
        $("#username").blur(function () {
            $.get("${pageContext.request.contextPath}/api/rest/user/query/" + $("#username").val(), function (data) {
                if (data.result) {
                    $("#label_username").text("用户名已存在!")
                } else {
                    $("#label_username").text("")
                }
            })
        })
    })

</script>





</body>
</html>
